#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2024/3/11 16:42
# @Author  : jeff
# @FileName: tasks_controller
from flask import Blueprint
from src.config.siwa_config import siwa
from src.service.task_service import TaskService
from src.vo.response import response

tasks = Blueprint('task', __name__, url_prefix='/task')


class Tasks:
    @staticmethod
    @tasks.route('/start', methods=['POST'])
    @siwa.doc(query=TaskVo, resp=TaskVoRes)
    def start_task():
        return response(TaskService.start_task())

    @staticmethod
    @tasks.route('/all', methods=['get'])
    def all_task():
        return response(TaskService.all_task())

    @staticmethod
    @tasks.route('/stop', methods=['POST'])
    def stop_task():
        return response(TaskService.stop_task())
